package com.agann.util;

import com.agann.model.Memory;
import com.agann.model.Record;

public class SROC extends Memory {
	
	/**
	 * Type Code
	 */
	public static final String TYPE_CODE = "SROC";
	public static final String SROC_SCORE = "sroc_score";
	
	private int ema_n;
	private int roc_n;
	private EMA_Util ema;
	private ROC_Util roc;

	public SROC(String code) {
		super(code);
		//TODO Add Exception Check
		String[] args = code.split("@");
		ema_n = Integer.valueOf(args[1]);
		roc_n = Integer.valueOf(args[2]);
		ema = new EMA_Util(ema_n);
		roc = new ROC_Util(roc_n);
	}

	@Override
	public void update(Record record) {
		ema.update(record.getClose());
		roc.update(ema.getScore());
		setScore(SROC_SCORE, roc.getScore());
	}

	@Override
	public void merge(String code) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void change(double rate) {
		// TODO Auto-generated method stub
		
	}

}
